package com.example.base.utils

import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Date

object DateTimeUtils {

    fun getTime():String{
        val format = SimpleDateFormat("yyyyMMddHHmmss")
        return format.format(System.currentTimeMillis())
    }
    fun getDateTime():String{
        val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
        return format.format(System.currentTimeMillis())
    }
    fun getDateTime1():String{
        val format = SimpleDateFormat("yyyy/MM/dd HH:mm:ss")
        return format.format(System.currentTimeMillis())
    }
    fun getTime1():String{
        val format = SimpleDateFormat("HH:mm:ss")
        return format.format(System.currentTimeMillis())
    }
    fun getDateYear():String{
        val format = SimpleDateFormat("yyyy/MM/dd")
        return format.format(System.currentTimeMillis())
    }
    fun getDate(date:Date):String{
        val format = SimpleDateFormat("MM-dd")
        return format.format(date)
    }
    fun getWeek(date: Date):String{
        val calendar = Calendar.getInstance()
        calendar.time = date
        var week = ""
        when(calendar.get(Calendar.DAY_OF_WEEK)){
            Calendar.SUNDAY->week = "周日"
            Calendar.MONDAY->week = "周一"
            Calendar.TUESDAY->week = "周二"
            Calendar.WEDNESDAY->week = "周三"
            Calendar.THURSDAY->week = "周四"
            Calendar.FRIDAY->week = "周五"
            Calendar.SATURDAY->week = "周六"
        }
        return week
    }
}